package com.adroiti.texasholdem.engine.combinations;

import java.util.List;

import com.adroiti.texasholdem.Card;

public class TwoPair  extends AbstractCombination{

	private High high;
	private Pair pair;

	public TwoPair(){
		this(new High(), new Pair());
	}
	
	public TwoPair(High high, Pair pair) {
		this.high = high;
		this.pair = pair;
	}

	@Override
	public int getRank(List<Card> player, List<Card> table) {
		int one = pair.getRank(player, table, 0);
		int two = pair.getRank(player, table, one);
		
		if(one > 0 && two > 0){
			return high.getRank(player, table)*(two + one);
		}
		return 0;
	}

	@Override
	public String getName() {
		return "Two pairs";
	}

	@Override
	public int getCombinationRank() {
		return 3;
	}

}
